package com.jc.platform.liyonghui.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jc.platform.liyonghui.entity.SalesContractFileInfoEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * ClassName IFileInfoMapper.java
 * Description  文件信息Mapper接口
 *
 * @author liyonghui
 * @version 3.0
 * @date 2021/08/07
 */
@Mapper
public interface ISalesContractFileInfoMapper extends BaseMapper<SalesContractFileInfoEntity> {

    /**
     * 根据业务ID 查询该业务下所有的文件信息
     *
     * @param businessCode
     * @return
     */
    @Select("select id,business_code,name from sales_contract_file_info where business_code = '${businessCode}'")
    List<SalesContractFileInfoEntity> findAllByBusinessCode(@Param("businessCode") String businessCode);

    /**
     * 根据业务ID 删除该业务ID下所有文件信息
     *
     * @param businessCode
     */
    @Select("delete from sales_contract_file_info where business_code = '${businessCode}'")
    void deleteByBusinessCode(@Param("businessCode") String businessCode);

}
